package com.tony.demo.fragmentdialog;

import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.tony.demo.R;
import com.tony.demo.R.id;
import com.tony.demo.R.layout;
import com.tony.demo.R.string;
import com.tony.demo.activity.BaseActivity;
import com.tony.demo.common.Utility;
import com.tony.demo.interfaces.OnDialogClickListener;
import com.tony.demo.widget.MyDialog;
import com.tony.demo.widget.MyToast;

public class DialogFragmentActivity extends BaseActivity implements OnClickListener, OnDialogClickListener{

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_dialog_fragment_layout);

		((Button)findViewById(R.id.btn_show_dialog)).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId() == R.id.btn_show_dialog){
			MyDialog dialog = MyDialog.createDialog(this, 0, R.string.dialog_title_warning, R.string.dialog_message_desc);
			dialog.show(getFragmentManager(), "dialogdemo");
		}
	}

	@Override
	public void onPositiveClick(int type) {
		MyToast.makeToast(this, Html.fromHtml("on" + "<font color=\"#f13c2a\">" + "Positive" + "</font>" + "Click"), Toast.LENGTH_SHORT).show();
	}

	@Override
	public void onNegativeClick(int type) {
		MyToast.makeToast(this, Html.fromHtml("on" + "<font color=\"#f13c2a\">" + "Negative" + "</font>" + "Click"), Toast.LENGTH_SHORT).show();
	}

	@Override
	public void onDialogDismiss(int type) {
		MyToast.makeToast(this, Utility.createStringFromHtml("DialogDismiss"), Toast.LENGTH_SHORT).show();
	}

}